import { GlobalClass } from "../../../../../com/mui/core/GlobalClass";
import { ImagesConst } from "../../../resource/ImagesConst";
import { ObjCreate } from "../../common/ObjCreate";
import { GlobalStyle } from "../../../../common/global/GlobalStyle";
import { Cache } from "../../../cache/Cache";
type int = number;
//class MountReinAddAdd
    
    export  class MountReinAddAdd /* flash.display.Sprite */
    {
        constructor()
        {
            
            this.initView();
            return;
        }

        /* internal  */initView(): void
        {
            this._bmRaise = GlobalClass.getBitmap(ImagesConst.RangeRaise);
            addChild(this._bmRaise);
            this._txAdd = ObjCreate.createTextField("", 12, 0, 34, 20, this, GlobalStyle.textFormat5);
            return;
        }

        public setTx(arg1: Map<any, any> /* flash.utils.Dictionary */, arg2: int): void
        {
            var loc1=0;
            var loc3=null;
            var loc4=null;
            var loc5=null;
            var loc6=null;
            var loc7=null;
            var loc8=0;
            var loc9=false;
            var loc10=0;
            var loc11=0;
            loc1 = arg1["add"];
            var loc2=arg1["key"];
            if (arg2 != 0) 
            {
                loc3 = Cache.instance.pack.mountsPackCache.getConfigNextReinAddtionalArray(arg2);
                loc4 = Cache.instance.pack.mountsPackCache.getConfigNextReinAddtionalArray(arg2 + 1);
                loc7 = new Map<any, any> /* flash.utils.Dictionary */();
                loc9 = false;
                loc10 = 0;
                while (loc10 < loc4.length) 
                {
                    loc5 = loc4[loc10];
                    loc9 = false;
                    loc11 = 0;
                    while (loc11 < loc3.length) 
                    {
                        loc6 = loc3[loc11];
                        if (loc5["key"] == loc6["key"]) 
                        {
                            loc8 = loc5["key"];
                            loc7[loc8] = loc5["value"] - loc6["value"];
                            loc9 = true;
                            break;
                        }
                        ++loc11;
                    }
                    if (!loc9) 
                    {
                        loc8 = loc5["key"];
                        loc7[loc8] = loc5["value"];
                    }
                    ++loc10;
                }
                if (loc7[loc2]) 
                {
                    loc1 = loc7[loc2];
                }
                else 
                {
                    loc1 = 0;
                }
                if (loc1 != 0) 
                {
                    this._txAdd.text = loc1.toString();
                    this._bmRaise.visible = true;
                }
                else 
                {
                    this.clean();
                }
            }
            else if (loc1 != 0) 
            {
                this._txAdd.text = loc1.toString();
                this._bmRaise.visible = true;
            }
            else 
            {
                this.clean();
            }
            return;
        }

        public clean(): void
        {
            this._txAdd.text = "";
            this._bmRaise.visible = false;
            return;
        }

        /* internal */ /* var */_bmRaise: Object /* flash.display.Bitmap */;

        /* internal */ /* var */_txAdd: Object /* flash.text.TextField */;
    }
